package problema016;

import java.math.BigInteger;

public class PowerSum {
	
	public static void main(String[] args){
		System.out.println(powerSum2());
	}
	
	public static double powerSum2(){
		int res = 0;
		String val = BigInteger.valueOf(2).pow(1000).toString();
		for(int i = 0; i < val.length(); i++){
		    res += val.charAt(i) - 48;
		}
		return res;
		
		
		
		/*long numero = 1, suma = 0, carry = 0, sobra = 0, sumaAct = 0;
		for(int i = 1; i <= 50; i++){
			numero *= 2;
		}System.out.println(numero);
		double pow;
		while(numero != 0){
			pow = Math.pow((numero % 10), 20);
			sumaAct = (long) pow;
			sumaAct += carry;
			sobra = sumaAct % 10;
			//System.out.println(sobra);
			suma += sobra;
			carry = (sumaAct - sobra)/10;
			numero = numero / 10;
		}
		suma += carry;
		return suma;*/
	}

}
